{extend name="public/base" /}
{block name="container"}
<div class="panel panel-default">
  <div class="panel-heading">
    <h4 class="panel-title">权限-管理组管理</h4>
     <div style="display: block; float: right; margin-top: -15px;" title="点击刷新"><a href="javascript:window.location.reload();"><i class="fa fa-refresh"></i></a></div>
  </div>
  <div class="panel-body panel-body-nopadding">

    <form class="form-horizontal form-bordered" action="" method="post" >
      <div class="form-group">
        <label class="col-sm-3 control-label">管理组名称：</label>
        <div class="col-sm-6"><label class="control-label">{$data.title}</label>
        </div>
      </div>
      <div class="form-group">
        <label class="col-sm-3 control-label">全部权限：</label>
        <div class="col-sm-6">
          <div class="col-sm-12 whh-inline">
            <div class="ckbox ckbox-danger checkbox-inline" style="padding-top:0;">
              <input type="checkbox" onClick="select_all(this,0);" id="all"/>
              <label for="all" color="red">全选(将管理员选为超级管理员比全选更好)</label>
            </div>
          </div>  
        </div>  
      </div>  
      {volist name="menu" id="vo"}
      <div class="form-group">
        <label class="col-sm-3 control-label">{$vo.menu_name}：</label>
        <div class="col-sm-9">
          <div class="col-sm-12 whh-inline">
            <div class="ckbox ckbox-warning checkbox-inline" style="padding-top:0;">
              <input type="checkbox" onClick="select_all(this,1);" id="fa0"/>
              <label for="fa0">全选</label>
            </div>
          </div>
          <br/>
          <div class="col-sm-12 whh-inline">
          <div class="col-sm-8 whh-inline">
            {volist name="$vo['rule'] " id="ru"}
           <div class="ckbox ckbox-primary checkbox-inline" style="padding-top:0;">
            <input type="checkbox" name="quan[]"
             <?php if($allrule != false)
             {
              if(in_array($ru['rule'],$allrule))
              {?> 
                checked="checked"
                <?php }
              }?>
             class="check" value="{$ru.rule}" id="dashboardboard" />
            <label for="dashboardboard">{$ru.ruleinfo}</label>
          </div><!-- rdio -->
          {/volist}

        </div>
      </div>

    </div>
  </div>
{/volist}
              

<div class="panel-footer">
 <div class="row">
  <div class="col-sm-6 col-sm-offset-3">
    <input type="hidden" name="id" value="3">
    <button type="submit" class="btn btn-primary">提交</button>
    <button type="button" class="btn btn-default" onclick="javascript:history.back(-1);">返回</button>
  </div>
</div>
</div><!-- panel-footer -->

</form>
</div>
</div>
</div><!-- rightpanel -->


</div><!-- contentpanel -->
</div><!-- mainpanel -->
{/block}
{block name="js"}
<script type="text/javascript">
  function select_all(o,i){
    if(i==0){
      var obj = $('input[type="checkbox"]');
    }else if(i==1){
      var obj = $(o).parent().parent().parent().find('input');
    }else if(i==2){
      var model = $(o).attr('id');
      var obj = $('input[name="model['+model+'][]"]');
    }
    if($(o).is(':checked')){
      obj.each(function(i,obj){
        $(this).prop('checked','true');
      });

    }else{
      obj.each(function(i,obj){
        $(this).prop('checked','');
      });
    }

  }
</script>
{/block}